﻿using System;
using System.Data;
using System.Collections.Generic;
using Chenxin.Lib.Business.Entity;
namespace Chenxin.Lib.Business.BLL
{
    /// <summary>
    /// 业务逻辑类ServiceChargePaymodeInfo 的摘要说明。
    /// </summary>
    public class ServiceChargePaymodeInfo
    {
        public ServiceChargePaymodeInfo()
        { }
        #region  成员方法
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Chenxin.Lib.Business.Entity.ServiceChargePaymodeInfo model)
        {
            Chenxin.Lib.Business.DAL.ServiceChargePaymodeInfo.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Chenxin.Lib.Business.Entity.ServiceChargePaymodeInfo model)
        {
            Chenxin.Lib.Business.DAL.ServiceChargePaymodeInfo.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(Guid RecordId)
        {

            Chenxin.Lib.Business.DAL.ServiceChargePaymodeInfo.Delete(RecordId);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Chenxin.Lib.Business.Entity.ServiceChargePaymodeInfo GetModel(Guid RecordId)
        {

            return Chenxin.Lib.Business.DAL.ServiceChargePaymodeInfo.GetModel(RecordId);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return Chenxin.Lib.Business.DAL.ServiceChargePaymodeInfo.GetList(strWhere);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Chenxin.Lib.Business.Entity.ServiceChargePaymodeInfo> GetModelList(string strWhere)
        {
            DataSet ds = Chenxin.Lib.Business.DAL.ServiceChargePaymodeInfo.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Chenxin.Lib.Business.Entity.ServiceChargePaymodeInfo> DataTableToList(DataTable dt)
        {
            List<Chenxin.Lib.Business.Entity.ServiceChargePaymodeInfo> modelList = new List<Chenxin.Lib.Business.Entity.ServiceChargePaymodeInfo>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Chenxin.Lib.Business.Entity.ServiceChargePaymodeInfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Chenxin.Lib.Business.Entity.ServiceChargePaymodeInfo();
                    if (dt.Rows[n]["RecordId"].ToString() != "")
                    {
                        model.RecordId = new Guid(dt.Rows[n]["RecordId"].ToString());
                    }
                    if (dt.Rows[n]["ReceiptId"].ToString() != "")
                    {
                        model.ReceiptId = new Guid(dt.Rows[n]["ReceiptId"].ToString());
                    }
                    model.PayMode = dt.Rows[n]["PayMode"].ToString();
                    if (dt.Rows[n]["PayMoney"].ToString() != "")
                    {
                        model.PayMoney = decimal.Parse(dt.Rows[n]["PayMoney"].ToString());
                    }
                    model.PayCode = dt.Rows[n]["PayCode"].ToString();
                    model.Memo = dt.Rows[n]["Memo"].ToString();
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetListByReceiptId(string ReceiptId)
        {
            return Chenxin.Lib.Business.DAL.ServiceChargePaymodeInfo.GetListByReceiptId(ReceiptId);
        }
        #endregion  成员方法
    }
}

